<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=10">
    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-control" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <title>优优车 - 登录</title>
    <link rel="stylesheet" href="/Public/mui/computer/css/login.css?v=asd"/>
    <link rel="stylesheet"  href="/Public/mui/static/bower_components/sweetalert/dist/sweetalert.css?a=asd">
</head>
<body style="overflow: hidden">
<img src="/Public/Home/images/logo_img.png" class="logo_img" alt="">
<div class="container">
    <div style="width: 100%;text-align: center">
        <img src="/Public/Home/images/title_img01.png" class="title_img" alt="">
    </div>
    <div class="Speed_progress">
        <ul class="Speed_progress_item">
            <li>
                <div>
                    <span class="span_star active_backg"></span>
                    <i class="active_backg">1</i>
                    <span class="active_backg"></span>
                </div>
                <p class="add_p active_colo">填写信息</p>
            </li>
            <li>
                <div>
                    <span class="coedyanzheng"></span>
                    <i class="coedyanzheng">2</i>
                    <span class="coedyanzheng"></span>
                </div>
                <p class="coedshenfen">验证身份</p>
            </li>
            <li>
                <div>
                    <span class="passid"></span>
                    <i class="passid">3</i>
                    <span class="passid"></span>
                </div>
                <p class="passidlas">设置新密码</p>
            </li>
            <li>
                <div>
                    <span class="completeid"></span>
                    <i class="completeid">4</i>
                    <span class="span_end "></span>
                </div>
                <p class="add_p01 completecolor">完成</p>
            </li>
        </ul>
        <!--表单1-->

        <div class="form_fotget coed1" >
            <form action="">
                <div>
                    <label>账户名:</label>
                    <input type="text" placeholder="请输入已注册手机号" id="phone_amdin" class="input_f">
                </div>
                <div>
                    <label>验证码:</label>
                    <input type="text" placeholder="请输入验证码"  class="input_f Obtain_input">
                    <span class="Obtain_yzm">获取验证码</span>
                    <span class="huanyiz">换一张</span>
                    <p class="correct"></p>
                    <p class="close_pp"></p>
                </div>
                <button type="button" class="Next_step" id="next_phone">下一步</button>
                <a href="javascript:history.go(-1);"><button type="button" class="Next_step" style="background: #e6e6e6;color: #5a5f66;margin-left: 57px;margin-top: 10px">返回</button></a>
            </form>
        </div>
        <!--表单2-->

        <div class="form_fotget coed2" style="width: 422px;display: none">
            <form action="">
                <div>
                    <label>验证码:</label>
                    <input type="text" placeholder="请输入验证码" id="coedyzm"  class="input_f">
                    <span class="Obtain_yzm01">获取验证码</span>
                </div>
                <button type="button" class="Next_step Next_coed" style="margin-left: 58px">下一步</button>
                <a href="javascript:history.go(-1);"><button type="button" class="Next_step" style="background: #e6e6e6;color: #5a5f66;margin-left: 58px;margin-top: 10px">返回</button></a>
            </form>
        </div>
        <!--表单3-->
        <div class="form_fotget coed3" style="display: none">
            <form action="" style="text-align: center">
                <div style="padding-left: 25px">
                    <label>新&nbsp;&nbsp;密&nbsp;&nbsp;码:</label>
                    <input type="password" placeholder="请输入密码" id="password_phone" class="input_f">
                </div>
                <div style="padding-left: 25px">
                    <label>确认密码:</label>
                    <input type="password" placeholder="请确认密码" id="endpassword_phone"  class="input_f">
                </div>
                <button type="button" class="Next_step Next_pass" style="margin-left: 29px">下一步</button>
                <a href="javascript:history.go(-1);"><button type="button" class="Next_step" style="background: #e6e6e6;color: #5a5f66;margin-left: 8%;margin-top: 10px">返回</button></a>
            </form>
        </div>
        <!--表单4-->
        <div class="form_fotget coed4" style="display: none">
            <div style="text-align: center">
                 <div class="Success">
                     <img src="/Public/mui/computer/img/Correct.png" alt="">
                     <span>您的密码已更改成功</span>
                     <p style="color: #cfcfcf">
                         <span class="Countdown"></span>
                         
                     </p>
                 </div>
                <button type="button" class="Next_step logout_header" style="margin-left:0;margin-top: 30px;">去登录</button>
            </div>
        </div>
        
    </div>
</div>
<p class="tab_title">
    <span>重庆优优汽车销售服务有限公司</span>
    <span>系统版本号1.0.1</span>
</p>
<script type="text/javascript" src="/Public/mui/static/js/jquery-3.2.0.min.js"></script>
<script type="text/javascript" src="/Public/mui/static/bower_components/sweetalert/dist/sweetalert.min.js"></script>
<script type="text/javascript" src="/Public/mui/static/bower_components/cookie/cookie.min.js"></script>
<script type="text/javascript" src="/Public/mui/computer/js/jquery.form.js?v=as"></script>
<script type="text/javascript" src="/Public/mui/computer/js/functions.js"></script>
<!-- <script type="text/javascript" src="/Public/mui/computer/js/back.js?v=as"></script> -->
<script>
var time = Math.random();
// document.write("<s"+"cript type='text/javascript' src='/Public/mui/computer/js/functions.js?v="+time+"'></scr"+"ipt>");
// document.write("<s"+"cript type='text/javascript' src='/Public/mui/computer/js/back.js?v="+time+"'></scr"+"ipt>");
    var statustype = GetQueryString('statystype');
    $(".input_f").focus(function(){
        $(this).css("background","#fff");
    })
    //验证码
    var yanzhengma=$(".Obtain_yzm");
    var yanzhengmas;
    function change(){
        // 验证码组成库
        var arrays= ['1','2','3','4','5','6','7','8','9','0',
            'a','b','c','d','e','f','g','h','i','j',
            'k','l','m','n','o','p','q','r','s','t',
            'u','v','w','x','y','z',
            'A','B','C','D','E','F','G','H','I','J',
            'K','L','M','N','O','P','Q','R','S','T',
            'U','V','W','X','Y','Z'];

        yanzhengmas='';// 重新初始化验证码
        for(var i = 0; i<4; i++){
            var r = parseInt(Math.random()*arrays.length);
            yanzhengmas += `<i><s>${arrays[r]}</s></i>`;
        }
        yanzhengma.html(yanzhengmas);
        for(var j=0;j<yanzhengma.children().length;j++){
            yanzhengma.children(`:nth-child(${j+1})`).css("color",rg());
        }
    }
    change();
    yanzhengma.click(change);
    $(".huanyiz").click(change);
    //单击验证
    $(".Obtain_input").blur(function(){
        var yzm = $(".Obtain_input").val().toUpperCase();
        if(yzm.length == 0) {
            return false;
        }else if(yzm!=yanzhengma.text().toUpperCase()) {
            $(".close_pp").show();
            $('.correct').hide();
            change();
        }else{
           $('.correct').show();
            $(".close_pp").hide();
        }
    });
    function rg(){
        var r=Math.floor(Math.random()*256);
        var g=Math.floor(Math.random()*256);
        var b=Math.floor(Math.random()*256);
        return `rgb(${r},${g},${b})`;
    }
    $("#next_phone").click(function(){
        var yzm = $(".Obtain_input").val().toUpperCase();
        if(yzm.length == 0) {
            sweetAlert("",'请输入验证码', "error");
            return false;
        }else if(yzm!=yanzhengma.text().toUpperCase()) {
            // sweetAlert("",'验证码不一致', "error");
            return false;
        }else{
           $('.correct').show();
            $(".close_pp").hide();
        }
        var phone_a = $("#phone_amdin").val();
        if(phone_a == ""){
            sweetAlert("",'请输入手机号！', "error");
            return false;
        }
        parmy = {phone:phone_a,judge:"judge"};
        post("/admin/Login/ResetPassword",parmy,function(respnose){
                if(respnose.success == "OK"){
                    $(".coed1").css("display","none");
                    $(".coed2").css("display","block");
                    $(".coedyanzheng").attr("class","active_backg");
                    $(".coedshenfen").attr("class","active_colo");
                }else if(respnose.success == "ERROR"){
                    sweetAlert("",respnose.message, "error");
                    return false;
                }
        },'json');
    });

    $(".Obtain_yzm01").click(function(){
        var this_ = this;
        var phone_a = $("#phone_amdin").val();
        if(phone_a == ""){
            sweetAlert("",'手机号获取失败,请重新验证',"error");
            setTimeout(function(){location.href='/Application/Admin/View/Login/forget_pwd.html'},2000);
        }
        var i = 60;
        parmy = {phone:phone_a,judge:"acceptcoed"};
        post("/admin/Login/ResetPassword",parmy,function(respnose){
                if(respnose.success == "OK"){
                    $(this_).attr('disabled',true);
                    $(this_).html('重新发送('+i+')');

                    var valb = window.setInterval(function() {
                        i = i-1;
                        $(this_).html('重新发送('+i+')');
                        if(i==0){
                            window.clearInterval(valb);
                            $(this_).attr('disabled',false).html('获取验证码');
                        }
                    },1000);
                }else if(respnose.success == "ERROR"){
                    sweetAlert("",respnose.message, "error");
                    return false;
                }
        },'json');
    });
    $(".Next_coed").click(function(){
        var coedlist = $("#coedyzm").val();
        if(!coedlist){
            sweetAlert("","请输入短信验证码", "error");
            return false;
        }
        parmy = {judge:"obtaincoed",phone_coed:coedlist};
        post("/admin/Login/ResetPassword",parmy,function(respnose){
                if(respnose.success == "OK"){
                    $(".coed1").css("display","none");
                    $(".coed2").css("display","none");
                    $(".coed3").css("display","block");
                    $(".passid").attr("class","active_backg");
                    $(".passidlas").attr("class","active_colo");
                }else if(respnose.success == "ERROR"){
                    sweetAlert("",respnose.message, "error");
                    return false;
                }
        },'json');
    });

    $(".Next_pass").click(function(){
        this_ = $(".Countdown");
        var passwordphone = $("#password_phone").val();
        var endpasswordphone = $("#endpassword_phone").val();
        var phone_a = $("#phone_amdin").val();
        var reg_password = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,10}$/;
        if(!reg_password.test(passwordphone)){
            sweetAlert("",'密码格式：6-10位，需包含字母、数字的组合。请确认！', "warning");
            return false;
        }
        if(passwordphone != endpasswordphone){
            sweetAlert("","输入密码不一致", "error");
            return false;
        }
        var i = 5;
        parmy = {judge:"passtype",passwordphone:passwordphone,endpasswordphone:endpasswordphone,phone:phone_a};
        post("/admin/Login/ResetPassword",parmy,function(respnose){
                if(respnose.success == "OK"){
                    $(".coed1").css("display","none");
                    $(".coed2").css("display","none");
                    $(".coed3").css("display","none");
                    $(".coed4").css("display","block");
                    $(".completeid").attr("class","active_backg");
                    $(".span_end").attr("class","span_end active_backg");
                    $(".completecolor").attr("class","add_p01 active_colo");
                    if(statustype == 1){
                        $(this_).html(''+i+'s后自动跳转页面');
                    }else{
                        $(this_).html(''+i+'s后自动跳转登录页面');
                    }
                    var valb = window.setInterval(function() {
                        i = i-1;
                        if(statustype == 1){
                            $(this_).html(''+i+'s后自动跳转页面');
                        }else{
                            $(this_).html(''+i+'s后自动跳转登录页面');
                        }
                        if(i==0){
                            window.clearInterval(valb);
                            window.history.back(-1);
                        }
                    },1000);
                }else if(respnose.success == "ERROR"){
                    sweetAlert("",respnose.message, "error");
                    return false;
                }
        },'json');
    });
    // $(".logout_header").click(function(){
    //     $.get('/Admin/login/LogoutPhone',{},function(response){
    //         if(response.success=='OK'){
    //             window.localStorage.JinDouCheToken = "";
    //             window.localStorage.UserPhone = "";
    //             top.location.href='/Admin/login/logoutComputer';
    //         }
    //     },'json');
    // });
    $(".logout_header").click(function(){
        if(statustype == 1){
            $.get('/Admin/login/LogoutPhone',{},function(response){
                if(response.success=='OK'){
                    window.localStorage.JinDouCheToken = "";
                    window.localStorage.UserPhone = "";
                    top.location.href='/Admin/login/logoutComputer';
                }
            },'json');
        }else{
            window.history.back(-1);
        }
    });
</script>
</body>
</html>